﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Maticsoft.DAL
{
	/// <summary>
	/// 数据访问类:Orders
	/// </summary>
	public partial class Orders
	{
		public Orders()
		{}
		#region  BasicMethod



		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(Maticsoft.Model.Orders model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into Orders(");
			strSql.Append("code,istz,cInvCNames,DealersManageID,originalordercode,s_province,s_city,s_county,address,label,lableextension,size,cInvCCode,cInvCName,partsCode,styleCode,cinvstd,cinvstdbackup,sizebackup,cInvCode,cInvnote,cInvprice,attribute,isurgent,createtime,shiyitime,quyitime,paystatus,orderstatus,orderpaystatus,membercode,membername,membermobile,backupprice,dmprice,price,source,crname,crvalue,orderremove,synchronous,imgs,note)");
			strSql.Append(" values (");
			strSql.Append("@code,@istz,@cInvCNames,@DealersManageID,@originalordercode,@s_province,@s_city,@s_county,@address,@label,@lableextension,@size,@cInvCCode,@cInvCName,@partsCode,@styleCode,@cinvstd,@cinvstdbackup,@sizebackup,@cInvCode,@cInvnote,@cInvprice,@attribute,@isurgent,@createtime,@shiyitime,@quyitime,@paystatus,@orderstatus,@orderpaystatus,@membercode,@membername,@membermobile,@backupprice,@dmprice,@price,@source,@crname,@crvalue,@orderremove,@synchronous,@imgs,@note)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@code", SqlDbType.VarChar,50),
					new SqlParameter("@istz", SqlDbType.VarChar,2),
					new SqlParameter("@cInvCNames", SqlDbType.VarChar,50),
					new SqlParameter("@DealersManageID", SqlDbType.VarChar,50),
					new SqlParameter("@originalordercode", SqlDbType.VarChar,50),
					new SqlParameter("@s_province", SqlDbType.VarChar,50),
					new SqlParameter("@s_city", SqlDbType.VarChar,50),
					new SqlParameter("@s_county", SqlDbType.VarChar,50),
					new SqlParameter("@address", SqlDbType.VarChar,100),
					new SqlParameter("@label", SqlDbType.VarChar,50),
					new SqlParameter("@lableextension", SqlDbType.VarChar,50),
					new SqlParameter("@size", SqlDbType.VarChar,50),
					new SqlParameter("@cInvCCode", SqlDbType.VarChar,50),
					new SqlParameter("@cInvCName", SqlDbType.VarChar,50),
					new SqlParameter("@partsCode", SqlDbType.VarChar,50),
					new SqlParameter("@styleCode", SqlDbType.VarChar,50),
					new SqlParameter("@cinvstd", SqlDbType.VarChar,50),
					new SqlParameter("@cinvstdbackup", SqlDbType.VarChar,50),
					new SqlParameter("@sizebackup", SqlDbType.VarChar,50),
					new SqlParameter("@cInvCode", SqlDbType.VarChar,50),
					new SqlParameter("@cInvnote", SqlDbType.VarChar,150),
					new SqlParameter("@cInvprice", SqlDbType.Decimal,5),
					new SqlParameter("@attribute", SqlDbType.Int,4),
					new SqlParameter("@isurgent", SqlDbType.Int,4),
					new SqlParameter("@createtime", SqlDbType.DateTime),
					new SqlParameter("@shiyitime", SqlDbType.DateTime),
					new SqlParameter("@quyitime", SqlDbType.DateTime),
					new SqlParameter("@paystatus", SqlDbType.Int,4),
					new SqlParameter("@orderstatus", SqlDbType.Int,4),
					new SqlParameter("@orderpaystatus", SqlDbType.Int,4),
					new SqlParameter("@membercode", SqlDbType.VarChar,8),
					new SqlParameter("@membername", SqlDbType.VarChar,8),
					new SqlParameter("@membermobile", SqlDbType.VarChar,50),
					new SqlParameter("@backupprice", SqlDbType.Decimal,9),
					new SqlParameter("@dmprice", SqlDbType.Decimal,9),
					new SqlParameter("@price", SqlDbType.Decimal,9),
					new SqlParameter("@source", SqlDbType.VarChar,50),
					new SqlParameter("@crname", SqlDbType.VarChar,10),
					new SqlParameter("@crvalue", SqlDbType.VarChar,20),
					new SqlParameter("@orderremove", SqlDbType.Int,4),
					new SqlParameter("@synchronous", SqlDbType.Int,4),
					new SqlParameter("@imgs", SqlDbType.VarChar,300),
					new SqlParameter("@note", SqlDbType.VarChar,350)};
			parameters[0].Value = model.code;
			parameters[1].Value = model.istz;
			parameters[2].Value = model.cInvCNames;
			parameters[3].Value = model.DealersManageID;
			parameters[4].Value = model.originalordercode;
			parameters[5].Value = model.s_province;
			parameters[6].Value = model.s_city;
			parameters[7].Value = model.s_county;
			parameters[8].Value = model.address;
			parameters[9].Value = model.label;
			parameters[10].Value = model.lableextension;
			parameters[11].Value = model.size;
			parameters[12].Value = model.cInvCCode;
			parameters[13].Value = model.cInvCName;
			parameters[14].Value = model.partsCode;
			parameters[15].Value = model.styleCode;
			parameters[16].Value = model.cinvstd;
			parameters[17].Value = model.cinvstdbackup;
			parameters[18].Value = model.sizebackup;
			parameters[19].Value = model.cInvCode;
			parameters[20].Value = model.cInvnote;
			parameters[21].Value = model.cInvprice;
			parameters[22].Value = model.attribute;
			parameters[23].Value = model.isurgent;
			parameters[24].Value = model.createtime;
			parameters[25].Value = model.shiyitime;
			parameters[26].Value = model.quyitime;
			parameters[27].Value = model.paystatus;
			parameters[28].Value = model.orderstatus;
			parameters[29].Value = model.orderpaystatus;
			parameters[30].Value = model.membercode;
			parameters[31].Value = model.membername;
			parameters[32].Value = model.membermobile;
			parameters[33].Value = model.backupprice;
			parameters[34].Value = model.dmprice;
			parameters[35].Value = model.price;
			parameters[36].Value = model.source;
			parameters[37].Value = model.crname;
			parameters[38].Value = model.crvalue;
			parameters[39].Value = model.orderremove;
			parameters[40].Value = model.synchronous;
			parameters[41].Value = model.imgs;
			parameters[42].Value = model.note;

			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Maticsoft.Model.Orders model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update Orders set ");
			strSql.Append("code=@code,");
			strSql.Append("istz=@istz,");
			strSql.Append("cInvCNames=@cInvCNames,");
			strSql.Append("DealersManageID=@DealersManageID,");
			strSql.Append("originalordercode=@originalordercode,");
			strSql.Append("s_province=@s_province,");
			strSql.Append("s_city=@s_city,");
			strSql.Append("s_county=@s_county,");
			strSql.Append("address=@address,");
			strSql.Append("label=@label,");
			strSql.Append("lableextension=@lableextension,");
			strSql.Append("size=@size,");
			strSql.Append("cInvCCode=@cInvCCode,");
			strSql.Append("cInvCName=@cInvCName,");
			strSql.Append("partsCode=@partsCode,");
			strSql.Append("styleCode=@styleCode,");
			strSql.Append("cinvstd=@cinvstd,");
			strSql.Append("cinvstdbackup=@cinvstdbackup,");
			strSql.Append("sizebackup=@sizebackup,");
			strSql.Append("cInvCode=@cInvCode,");
			strSql.Append("cInvnote=@cInvnote,");
			strSql.Append("cInvprice=@cInvprice,");
			strSql.Append("attribute=@attribute,");
			strSql.Append("isurgent=@isurgent,");
			strSql.Append("createtime=@createtime,");
			strSql.Append("shiyitime=@shiyitime,");
			strSql.Append("quyitime=@quyitime,");
			strSql.Append("paystatus=@paystatus,");
			strSql.Append("orderstatus=@orderstatus,");
			strSql.Append("orderpaystatus=@orderpaystatus,");
			strSql.Append("membercode=@membercode,");
			strSql.Append("membername=@membername,");
			strSql.Append("membermobile=@membermobile,");
			strSql.Append("backupprice=@backupprice,");
			strSql.Append("dmprice=@dmprice,");
			strSql.Append("price=@price,");
			strSql.Append("source=@source,");
			strSql.Append("crname=@crname,");
			strSql.Append("crvalue=@crvalue,");
			strSql.Append("orderremove=@orderremove,");
			strSql.Append("synchronous=@synchronous,");
			strSql.Append("imgs=@imgs,");
			strSql.Append("note=@note");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@code", SqlDbType.VarChar,50),
					new SqlParameter("@istz", SqlDbType.VarChar,2),
					new SqlParameter("@cInvCNames", SqlDbType.VarChar,50),
					new SqlParameter("@DealersManageID", SqlDbType.VarChar,50),
					new SqlParameter("@originalordercode", SqlDbType.VarChar,50),
					new SqlParameter("@s_province", SqlDbType.VarChar,50),
					new SqlParameter("@s_city", SqlDbType.VarChar,50),
					new SqlParameter("@s_county", SqlDbType.VarChar,50),
					new SqlParameter("@address", SqlDbType.VarChar,100),
					new SqlParameter("@label", SqlDbType.VarChar,50),
					new SqlParameter("@lableextension", SqlDbType.VarChar,50),
					new SqlParameter("@size", SqlDbType.VarChar,50),
					new SqlParameter("@cInvCCode", SqlDbType.VarChar,50),
					new SqlParameter("@cInvCName", SqlDbType.VarChar,50),
					new SqlParameter("@partsCode", SqlDbType.VarChar,50),
					new SqlParameter("@styleCode", SqlDbType.VarChar,50),
					new SqlParameter("@cinvstd", SqlDbType.VarChar,50),
					new SqlParameter("@cinvstdbackup", SqlDbType.VarChar,50),
					new SqlParameter("@sizebackup", SqlDbType.VarChar,50),
					new SqlParameter("@cInvCode", SqlDbType.VarChar,50),
					new SqlParameter("@cInvnote", SqlDbType.VarChar,150),
					new SqlParameter("@cInvprice", SqlDbType.Decimal,5),
					new SqlParameter("@attribute", SqlDbType.Int,4),
					new SqlParameter("@isurgent", SqlDbType.Int,4),
					new SqlParameter("@createtime", SqlDbType.DateTime),
					new SqlParameter("@shiyitime", SqlDbType.DateTime),
					new SqlParameter("@quyitime", SqlDbType.DateTime),
					new SqlParameter("@paystatus", SqlDbType.Int,4),
					new SqlParameter("@orderstatus", SqlDbType.Int,4),
					new SqlParameter("@orderpaystatus", SqlDbType.Int,4),
					new SqlParameter("@membercode", SqlDbType.VarChar,8),
					new SqlParameter("@membername", SqlDbType.VarChar,8),
					new SqlParameter("@membermobile", SqlDbType.VarChar,50),
					new SqlParameter("@backupprice", SqlDbType.Decimal,9),
					new SqlParameter("@dmprice", SqlDbType.Decimal,9),
					new SqlParameter("@price", SqlDbType.Decimal,9),
					new SqlParameter("@source", SqlDbType.VarChar,50),
					new SqlParameter("@crname", SqlDbType.VarChar,10),
					new SqlParameter("@crvalue", SqlDbType.VarChar,20),
					new SqlParameter("@orderremove", SqlDbType.Int,4),
					new SqlParameter("@synchronous", SqlDbType.Int,4),
					new SqlParameter("@imgs", SqlDbType.VarChar,300),
					new SqlParameter("@note", SqlDbType.VarChar,350),
					new SqlParameter("@id", SqlDbType.Int,4)};
			parameters[0].Value = model.code;
			parameters[1].Value = model.istz;
			parameters[2].Value = model.cInvCNames;
			parameters[3].Value = model.DealersManageID;
			parameters[4].Value = model.originalordercode;
			parameters[5].Value = model.s_province;
			parameters[6].Value = model.s_city;
			parameters[7].Value = model.s_county;
			parameters[8].Value = model.address;
			parameters[9].Value = model.label;
			parameters[10].Value = model.lableextension;
			parameters[11].Value = model.size;
			parameters[12].Value = model.cInvCCode;
			parameters[13].Value = model.cInvCName;
			parameters[14].Value = model.partsCode;
			parameters[15].Value = model.styleCode;
			parameters[16].Value = model.cinvstd;
			parameters[17].Value = model.cinvstdbackup;
			parameters[18].Value = model.sizebackup;
			parameters[19].Value = model.cInvCode;
			parameters[20].Value = model.cInvnote;
			parameters[21].Value = model.cInvprice;
			parameters[22].Value = model.attribute;
			parameters[23].Value = model.isurgent;
			parameters[24].Value = model.createtime;
			parameters[25].Value = model.shiyitime;
			parameters[26].Value = model.quyitime;
			parameters[27].Value = model.paystatus;
			parameters[28].Value = model.orderstatus;
			parameters[29].Value = model.orderpaystatus;
			parameters[30].Value = model.membercode;
			parameters[31].Value = model.membername;
			parameters[32].Value = model.membermobile;
			parameters[33].Value = model.backupprice;
			parameters[34].Value = model.dmprice;
			parameters[35].Value = model.price;
			parameters[36].Value = model.source;
			parameters[37].Value = model.crname;
			parameters[38].Value = model.crvalue;
			parameters[39].Value = model.orderremove;
			parameters[40].Value = model.synchronous;
			parameters[41].Value = model.imgs;
			parameters[42].Value = model.note;
			parameters[43].Value = model.id;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from Orders ");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
			parameters[0].Value = id;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from Orders ");
			strSql.Append(" where id in ("+idlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Maticsoft.Model.Orders GetModel(int id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 id,code,istz,cInvCNames,DealersManageID,originalordercode,s_province,s_city,s_county,address,label,lableextension,size,cInvCCode,cInvCName,partsCode,styleCode,cinvstd,cinvstdbackup,sizebackup,cInvCode,cInvnote,cInvprice,attribute,isurgent,createtime,shiyitime,quyitime,paystatus,orderstatus,orderpaystatus,membercode,membername,membermobile,backupprice,dmprice,price,source,crname,crvalue,orderremove,synchronous,imgs,note from Orders ");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
			parameters[0].Value = id;

			Maticsoft.Model.Orders model=new Maticsoft.Model.Orders();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Maticsoft.Model.Orders DataRowToModel(DataRow row)
		{
			Maticsoft.Model.Orders model=new Maticsoft.Model.Orders();
			if (row != null)
			{
				if(row["id"]!=null && row["id"].ToString()!="")
				{
					model.id=int.Parse(row["id"].ToString());
				}
				if(row["code"]!=null)
				{
					model.code=row["code"].ToString();
				}
				if(row["istz"]!=null)
				{
					model.istz=row["istz"].ToString();
				}
				if(row["cInvCNames"]!=null)
				{
					model.cInvCNames=row["cInvCNames"].ToString();
				}
				if(row["DealersManageID"]!=null)
				{
					model.DealersManageID=row["DealersManageID"].ToString();
				}
				if(row["originalordercode"]!=null)
				{
					model.originalordercode=row["originalordercode"].ToString();
				}
				if(row["s_province"]!=null)
				{
					model.s_province=row["s_province"].ToString();
				}
				if(row["s_city"]!=null)
				{
					model.s_city=row["s_city"].ToString();
				}
				if(row["s_county"]!=null)
				{
					model.s_county=row["s_county"].ToString();
				}
				if(row["address"]!=null)
				{
					model.address=row["address"].ToString();
				}
				if(row["label"]!=null)
				{
					model.label=row["label"].ToString();
				}
				if(row["lableextension"]!=null)
				{
					model.lableextension=row["lableextension"].ToString();
				}
				if(row["size"]!=null)
				{
					model.size=row["size"].ToString();
				}
				if(row["cInvCCode"]!=null)
				{
					model.cInvCCode=row["cInvCCode"].ToString();
				}
				if(row["cInvCName"]!=null)
				{
					model.cInvCName=row["cInvCName"].ToString();
				}
				if(row["partsCode"]!=null)
				{
					model.partsCode=row["partsCode"].ToString();
				}
				if(row["styleCode"]!=null)
				{
					model.styleCode=row["styleCode"].ToString();
				}
				if(row["cinvstd"]!=null)
				{
					model.cinvstd=row["cinvstd"].ToString();
				}
				if(row["cinvstdbackup"]!=null)
				{
					model.cinvstdbackup=row["cinvstdbackup"].ToString();
				}
				if(row["sizebackup"]!=null)
				{
					model.sizebackup=row["sizebackup"].ToString();
				}
				if(row["cInvCode"]!=null)
				{
					model.cInvCode=row["cInvCode"].ToString();
				}
				if(row["cInvnote"]!=null)
				{
					model.cInvnote=row["cInvnote"].ToString();
				}
				if(row["cInvprice"]!=null && row["cInvprice"].ToString()!="")
				{
					model.cInvprice=decimal.Parse(row["cInvprice"].ToString());
				}
				if(row["attribute"]!=null && row["attribute"].ToString()!="")
				{
					model.attribute=int.Parse(row["attribute"].ToString());
				}
				if(row["isurgent"]!=null && row["isurgent"].ToString()!="")
				{
					model.isurgent=int.Parse(row["isurgent"].ToString());
				}
				if(row["createtime"]!=null && row["createtime"].ToString()!="")
				{
					model.createtime=DateTime.Parse(row["createtime"].ToString());
				}
				if(row["shiyitime"]!=null && row["shiyitime"].ToString()!="")
				{
					model.shiyitime=DateTime.Parse(row["shiyitime"].ToString());
				}
				if(row["quyitime"]!=null && row["quyitime"].ToString()!="")
				{
					model.quyitime=DateTime.Parse(row["quyitime"].ToString());
				}
				if(row["paystatus"]!=null && row["paystatus"].ToString()!="")
				{
					model.paystatus=int.Parse(row["paystatus"].ToString());
				}
				if(row["orderstatus"]!=null && row["orderstatus"].ToString()!="")
				{
					model.orderstatus=int.Parse(row["orderstatus"].ToString());
				}
				if(row["orderpaystatus"]!=null && row["orderpaystatus"].ToString()!="")
				{
					model.orderpaystatus=int.Parse(row["orderpaystatus"].ToString());
				}
				if(row["membercode"]!=null)
				{
					model.membercode=row["membercode"].ToString();
				}
				if(row["membername"]!=null)
				{
					model.membername=row["membername"].ToString();
				}
				if(row["membermobile"]!=null)
				{
					model.membermobile=row["membermobile"].ToString();
				}
				if(row["backupprice"]!=null && row["backupprice"].ToString()!="")
				{
					model.backupprice=decimal.Parse(row["backupprice"].ToString());
				}
				if(row["dmprice"]!=null && row["dmprice"].ToString()!="")
				{
					model.dmprice=decimal.Parse(row["dmprice"].ToString());
				}
				if(row["price"]!=null && row["price"].ToString()!="")
				{
					model.price=decimal.Parse(row["price"].ToString());
				}
				if(row["source"]!=null)
				{
					model.source=row["source"].ToString();
				}
				if(row["crname"]!=null)
				{
					model.crname=row["crname"].ToString();
				}
				if(row["crvalue"]!=null)
				{
					model.crvalue=row["crvalue"].ToString();
				}
				if(row["orderremove"]!=null && row["orderremove"].ToString()!="")
				{
					model.orderremove=int.Parse(row["orderremove"].ToString());
				}
				if(row["synchronous"]!=null && row["synchronous"].ToString()!="")
				{
					model.synchronous=int.Parse(row["synchronous"].ToString());
				}
				if(row["imgs"]!=null)
				{
					model.imgs=row["imgs"].ToString();
				}
				if(row["note"]!=null)
				{
					model.note=row["note"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select id,code,istz,cInvCNames,DealersManageID,originalordercode,s_province,s_city,s_county,address,label,lableextension,size,cInvCCode,cInvCName,partsCode,styleCode,cinvstd,cinvstdbackup,sizebackup,cInvCode,cInvnote,cInvprice,attribute,isurgent,createtime,shiyitime,quyitime,paystatus,orderstatus,orderpaystatus,membercode,membername,membermobile,backupprice,dmprice,price,source,crname,crvalue,orderremove,synchronous,imgs,note ");
			strSql.Append(" FROM Orders ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" id,code,istz,cInvCNames,DealersManageID,originalordercode,s_province,s_city,s_county,address,label,lableextension,size,cInvCCode,cInvCName,partsCode,styleCode,cinvstd,cinvstdbackup,sizebackup,cInvCode,cInvnote,cInvprice,attribute,isurgent,createtime,shiyitime,quyitime,paystatus,orderstatus,orderpaystatus,membercode,membername,membermobile,backupprice,dmprice,price,source,crname,crvalue,orderremove,synchronous,imgs,note ");
			strSql.Append(" FROM Orders ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM Orders ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.id desc");
			}
			strSql.Append(")AS Row, T.*  from Orders T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "Orders";
			parameters[1].Value = "id";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod

		#endregion  ExtensionMethod
	}
}

